import 'package:OASys/entity/AnnouncementVo.dart';
import 'package:OASys/entity/EventVo.dart';
import 'package:OASys/entity/MatterVo.dart';
import 'package:OASys/entity/MeetingInfoVo.dart';
import 'package:OASys/entity/MeetingVo.dart';
import 'package:OASys/entity/MenuTreeVo.dart';
import 'package:OASys/entity/MenuVo.dart';
import 'package:OASys/entity/RoleVo.dart';
import 'package:OASys/entity/UserVo.dart';

class EntityFactory {
  static T generateOBJ<T>(json) {
    if (json == null) {
      return null;
    }
//可以在这里加入任何需要并且可以转换的类型，例如下面
    else if (T.toString() == "UserVo") {
      return UserVo.fromJson(json) as T;
    } else if (T.toString() == "RoleVo") {
      return RoleVo.fromJson(json) as T;
    } else if (T.toString() == "MenuVo") {
      return MenuVo.fromJson(json) as T;
    } else if (T.toString() == "MenuTreeVo") {
      return MenuTreeVo.fromJson(json) as T;
    } else if (T.toString() == "MeetingVo") {
      return MeetingVo.fromJson(json) as T;
    } else if (T.toString() == "EventVo") {
      return EventVo.fromJson(json) as T;
    } else if (T.toString() == "MeetingInfoVo") {
      return MeetingInfoVo.fromJson(json) as T;
    } else if (T.toString() == "AnnouncementVo") {
      return AnnouncementVo.fromJson(json) as T;
    } else if (T.toString() == "MatterVo") {
      return MatterVo.fromJson(json) as T;
    } else {
      return json as T;
    }
  }
}
